

iDB = {}


iDB.blank = love.graphics.newImage("resources/images/transparent.png")

iDB.UI = {}

iDB.UI.buttonimage = love.graphics.newImage("resources/images/UI/coat/button.png")
--local sh = sw

--[[
	Welcome to easy split.  See this shit?

topLeft = SpriteBatch:addq(
	love.graphics.newQuad(0, 0, bQTS, bQTS, sw, sh)
	, x, y, r, sx, sy, ox, oy, kx, ky )

topRight = SpriteBatch:addq(
	love.graphics.newQuad(bQTS, 0, bQTS, bQTS, sw, sh)
	, x, y, r, sx, sy, ox, oy, kx, ky )

bottomLeft = SpriteBatch:addq(
	love.graphics.newQuad(0, bQTS, bQTS, bQTS, sw, sh)
	, x, y, r, sx, sy, ox, oy, kx, ky )

bottomRight = SpriteBatch:addq(
	love.graphics.newQuad(bQTS, bQTS, bQTS, bQTS, sw, sh)
	, x, y, r, sx, sy, ox, oy, kx, ky )

	fuck that.  check this out...
]]

function easySplit(tilesX, tilesY, image, scale)

	if not scale then 
		scale = 1
	end

	local w = scale*image:getWidth()/tilesX
	local quadTable = {}

	for tY=1,tilesY do
		quadTable[tY] = {}
		for tX=1,tilesX do
			quadTable[tY] = love.graphics.newQuad(tX*w, tY*w, w, w, scale, scale)
	end

	return quadTable
end

-- Easy split will break a square image into sections of a specified
-- size, and return a table like so:
-- i means index, each index will contain a quad
--[[
	i1  i2  i3
	i4  i5  i6
	i7  i8  i9


	or


	i1  i2
	i3  i4

	so like a book, left to right, then down.

	so check it:

	iDB.UI.button = easySplit(2,2, iDB.UI.buttonimage, 5)

	button is now a table of 4 quads... but I need those middle sections too...

	enter: tileSplit
]]
function tileSplit(tilesX, tilesY, tileSizeX, tileSizeY, image, scale)

	if not scale then 
		scale = 1
	end

	local quadTable = {}

	for tY=1,tilesY do
		quadTable[tY] = {}
		for tX=1,tilesX do
			quadTable[tX] = love.graphics.newQuad(tX*w, tY*w, tileSizeX, tileSizeY, scale, scale)
	end

	return quadTable
end

-- tileSplit can nab those tricky spots for us, leaving the actual button quad code as... 

--tileSplit(2,2, iDB.UI.buttonimage, 5)

--"wait i thought that was the code, why is it commented" BECAUSE I TRICKED YOU
-- we're still making shit better.  This time for real... although MADE for UI elements, I'm sure it will have other uses.
-- it just makes it pretty

function UIname(quadTable)
	local rows = {"top", "", "bottom"}
	local columns = {"left", "", "right"}

	for q,w in pairs(rows) do
		for k,v in pairs(columns) do
			local stringything = w .. v
			if stringything == "" then 
				stringything = center 
			end
			quadTable[stringything] = quadTable[q][k]
		end
	end
end

-- now for those buttons...
iDB.UI.button = UIname(tileSplit(3, 3, 5.5, 5.5, iDB.UI.buttonImage, 5))
-- that's it :)
-- now don't make your mods like shit or I'll wreck your shit with updates like Garry Newman does!




iDB.UI.leftArrow = love.graphics.newImage("resources/images/EditorUI/leftArrow.png")
iDB.UI.rightArrow = love.graphics.newImage("resources/images/EditorUI/rightArrow.png")
iDB.UI.saveSnippet = love.graphics.newImage("resources/images/EditorUI/saveSnippet.png")
iDB.UI.testLevel = love.graphics.newImage("resources/images/EditorUI/testLevel.png")

iDB.intro = {}

iDB.intro.oilDrum = love.graphics.newImage("resources/images/intro/oilDrum.png")
iDB.intro.fizz = love.graphics.newImage("resources/images/intro/Fizz.png")
iDB.intro.loveEngine = love.graphics.newImage("resources/images/intro/LoveEngine.png")

--[[
iDB. = love.graphics.newImage("resources/images/EditorUI/rightArrow.png")


iDB. = love.graphics.newImage("resources/images/EditorUI/leftArrow.png")

iDB. =

iDB. =

iDB. =

iDB. =

iDB. =

iDB. =

iDB. =

iDB. =

iDB. =

iDB. =

iDB. =

iDB. =

iDB. =

iDB. =

iDB. =

iDB. =

--]]
